package demo3;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
    @Autowired
    //private Sweater s;
    @Qualifier("Winter")
    private Clothes clothes;
    public void play(){
        //穿衣服出去玩
//        Sweater sweater = new Sweater();
       clothes.wear();

        //如果更换其他类，需更改源代码
//        Shirt shirt = new Shirt();
//        shirt.wear();
        System.out.println("出去玩");
    }
}
